package com.qf.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;

/**
 * @author 千锋教育
 * @Company http://www.mobiletrain.org/
 * @Version 1.0
 */
@Controller
@RequestMapping("/test")
public class TestController {

    @RequestMapping("/login")
    public String login(HttpSession session, String username , String password, String code){
        //用户名和密码 需要到数据库进行校验
        System.out.println(username);
        System.out.println(password);
        //code是用户输入的验证码
        //服务端的验证码是存在 session中
        String captcha = (String) session.getAttribute("captcha");
        if(code != null && code.equalsIgnoreCase(captcha)){
            return "/success.jsp";
        }

        return "/error.jsp";
    }
}
